// pages/reliang/reliang.js
Page({

    /**
     * 页面的初始数据
     */
    data: {

    },
    csc:function(e){
        var name = e.detail.value.name;
        var shengao = parseFloat(e.detail.value.shengao) ;
        var tizhong = parseFloat(e.detail.value.tizhong) ;
        var year = parseFloat(e.detail.value.year);
        var reliang = 0;
        if(name == "男"||name == "nan"||name == "man"){
          reliang = parseInt(66+(13.7*tizhong)+(5*shengao)-(6.8*year));
        }else if(name == "女"||name == "nv"||name == "woman"){
          reliang = parseInt(655+(9.6*tizhong)+(1.7*shengao)-(4.7*year));
        }else{
          wx.showToast({
            title: '请输入正常的性别',
            icon:'none',
            duration:2000
          })
        }
        var man = new Array();
        var man1 = new this.man('1',name,shengao,tizhong,year,reliang);
        man.push(man1);
        wx.setStorageSync('热量',man );
        try{
          var value = wx.getStorageSync('热量');
          console.log(value);
        }catch(e){
          console.log(e);
        }
        this.setData({
          reliang:reliang
        })
      },
      man:function(id,name,shengao,tizhong,year,reliang){
        this.id = id;
        this.name = name;
        this.shengao = shengao;
        this.tizhong = tizhong;
        this.year = year;
        this.reliang = reliang;
      },
    goToNotice7: function(parm){
        wx.navigateTo({
            url: '/pages/reliang2/reliang2',//要跳转到的页面路径
      })
      },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {

    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})